/*
 * File:   main.c
 * Author: powerlab
 *
 * Created on July 11, 2011, 9:31 AM
 */
#include <p18cxxx.h>
#include "pwm.h"
#include "main.h"
#include <adc.h>
#include <delays.h>
#include "power.h"

#pragma config DEBUG = ON
#pragma config OSC = INTIO2 
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config MCLRE = OFF
#pragma config BOR = OFF

void main (void)
 {
    int result;
    OSCCON = 0x72;
    //InitPWM();
    //PWMFrequency(20000);
    //PWMDutyCycle(50);

    // configure A/D convertor
    OpenADC( ADC_FOSC_32      &
           ADC_RIGHT_JUST   &
           ADC_12_TAD       ,
           ADC_CH0          &
           ADC_REF_VDD_VSS  &
           ADC_INT_OFF, ADC_CH10 );
    Delay10TCYx( 5 );     // Delay for 50TCY
    while(9)
    {
        result = OutputVoltage();
        nop();
    }
    while(1);
 }


